﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using AdvanceScreening.Annotations;

namespace AdvanceScreening
{
    public class ViewModel : INotifyPropertyChanged
    {
        public static readonly CaptureRegion ScreenRegion =new CaptureRegion("Screen", IntPtr.Zero);
        private bool _isRecording;

        public ViewModel()
        {
            SelectedCaptureRegion = ScreenRegion;
        }

        public CaptureRegion SelectedCaptureRegion { get; set; }

        public bool IsRecording
        {
            get { return _isRecording; }
            set
            {
                if (_isRecording != value)
                {
                    _isRecording = value;
                    OnPropertyChanged();
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}